import $http from '../assets/js/http'

export function getDorm(areaNumber) {
  return $http.post('building/Building/getDorm', {
    areaNumber
  });
}

export async function searchDorm({
  caretaker,
  _area,
  _dorm,
  page
}) {
  return $http.post('building/Building/searchDorm', {
    caretaker,
    _area,
    _dorm,
    page
  })
}

export async function newDorm({
  dormName,
  layers,
  caretaker,
  area,
  createman,
  remark
}) {
  return $http.post('building/Building/newDorm', {
    dormName,
    layers,
    caretaker,
    area,
    createman,
    remark
  })
}

export async function alterDorm({
  affiliationName,
  affiliationNumber,
  dormNumber,
  dormName,
  createman,
  createtime,
  layers,
  caretaker,
  person,
  remark,
  number
}) {
  return $http.post('building/Building/alterDorm', {
    affiliationName,
    affiliationNumber,
    dormNumber,
    dormName,
    createman,
    createtime,
    layers,
    caretaker,
    person,
    remark,
    number
  })
}

export async function deleteDorm(affiliationNumber, dormNumber) {
  return $http.post('building/Building/deleteDorm', {
    affiliationNumber,
    dormNumber
  })
}


export async function getFloor(affiliationNumber, dormNumber) {
  return $http.post('building/Building/getFloor', {
    affiliationNumber,
    dormNumber
  })
}
